Socket
Socket
Sign inDemoInstall

deep-eql

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deep-eql

Improved deep equality testing for Node.js and the browser.


Version published
Weekly downloads
13M
increased by0.28%
Maintainers
1
Weekly downloads
 
Created

What is deep-eql?

The deep-eql package is a deep equality testing library that allows developers to compare two values for structural equality, rather than just reference equality. It is useful for testing and assertions when you need to ensure that two complex objects, arrays, or other nested structures are equivalent in content.

What are deep-eql's main functionalities?

Deep Equality Check

This feature allows you to check if two objects are deeply equal, meaning their structure and nested values are equivalent.

const deepEql = require('deep-eql');
const obj1 = { a: 1, b: { c: 2 } };
const obj2 = { a: 1, b: { c: 2 } };
console.log(deepEql(obj1, obj2)); // true

Custom Type Comparisons

This feature allows you to provide a custom comparator function to define equality for specific types or instances.

const deepEql = require('deep-eql');
class Person {
  constructor(name) {
    this.name = name;
  }
}
const person1 = new Person('Alice');
const person2 = new Person('Alice');
console.log(deepEql(person1, person2, { comparator: (a, b) => a.name === b.name })); // true

Other packages similar to deep-eql

Keywords

FAQs

Package last updated on 05 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc